(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Children's Library | Biodiversity Heritage Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "Arduino"

Hacking the Wii MotionPlus to Talk to the Arduino 



i 



Make Projects 



build, hack, tweak, share, discover, J 



Hacking the Wii MotionPlus to 



Talk to the Arduino 



Written By: Riley Porter 



f TOOLS: 



Wire cutter/stripper (1) 



© PARTS: 

• Arduino microcontroller (3) 

• Wii Motion Plus (1) 

• Wii Chuck Adapter (1) 

This is not required if you plan on 
soldering or splicing into the wii motion 
plus directly. 

• 470 Ohm resistors (2) 

• Hook-up wire (1) 

• Servo (generic) (3) 
(Optional) 



SUMMARY 



The Wii MotionPlus (wm+) uses j2c (Inter- Integrated Circuits) for all of its communications. 
To learn how to make the Arduino talk to the wm+, we'll program the Arduino to talk to it 
using the i2c protocol. This tutorial will show you how to wire the wm+ to the Arduino and 
toss some code into a sketch in order to gather gyroscope data. 



© Make Projects 



www.makeprojects.com 



Page 1 of 7 



Hacking the Wii MotionPlus to Talk to the Arduino 



The there are many pre-existing tutorials on how to use i2c with the Arduino. 

i2c EEPROM Arduino Tutorial i2c Port Expander Arduino Tutorial 

» This project is brought to you by element14 . Be sure to check out the e1 4 Arduino page. 









**a o***. ****rt»- 




1* HTlO£i. 










tf 




Projects 



First you'll want to lay out all of the parts you will need. (You can use this photo for 
reference). 

• Wii MotionPlus 

• Jumper Wires 

• WiiChuck Adapter 

• 2x 470 Ohm Resistors (picture shows 3) 

• Optional 2 - 3 Servos 

• In this layout image, there are two Wii MotionPlus units shown. One has been 
removed from its housing. The other has not. Only one is needed for this project. 
If you plan on removing the housing, see the last step in this project before continuing. 

• Additional reading material/ references can be found on the last step of this 
project. 





© Make Projects 



www.makeprojects.com 



Page 2 of 7 



Hacking the Wii MotionPlus to Talk to the Arduino 



Step 2 




j 3 i tit i:u-h 

. Ill II i 










■ ■ ■■ »■■■■■■ ■ t ■ ■ ■ ■ * ■ ■■ iIUj ^J LJkUA. L| 
i- ri pi - p-i pi- pi p-r-i ri PTf ^ - "fOI Jll 

■ ■ ■■ HI ■■■ ■ .1 ■ ■■ ■ il ■ ■■ ■ I ■ [#| J fc ■ ■"* J ■ 







----- 

■ ■ » ■ ■ 





• Insert the WiiChuck Adapter into the wm+ (See picture for WiiChuck Adapter Orientation. 
On the third picture the "elk" side is circled. Make sure yours is the same.) 

• Connect the Arduino to the headers on the WiiChuck Adapter. 

• See below for correct Pin Mappings: 

• + goes to 3v 

• D (SDA) goes to Analog 4 (A4) 

• C (SCL) goes to Analog 5 (A5) 

• Be sure to remember to place 470 Ohm pull-up resistors between SDA and A4 and 
SCL and A5. See circuit drawing for reference. I used female jumpers and the 
resistors to create a male end to plug into the Arduino. See this as a reference: 
http://bit.ly/gJuqUu 



it 



© Make Projects 



www.makeprojects.com 



Page 3 of 7 



Hacking the Wii MotionPlus to Talk to the Arduino 




Next, download the Arduino sketch from: http://bit.ly/e7Y1zr Special thanks to Miles 
Moody for providing the source code! 

Be sure to have your wm+ sensor sitting upright and somewhat level with the WiiChuck 
adapter pointing skyward. 

Load the sketch onto the Arduino. (See http://bit.ly/7cymtl for help with this.) 

Click on the Serial Console button in the Arduino development environment. 

You should see lots of numbers for Pitch, Roll, and Yaw screaming by. 

Now, when you pick up the wm+, you should see the Pitch, Roll, and Yaw numbers start to 
change! 

You now are reading 3-axis gyroscope data on the Arduino platform. Well done, hardware 
hacker! 

Note: In picture 3 there is a circle around the 2 resistors. This is to remind you that 
you do not just plug the jumpers straight into the Arduino. REMEMBER TO RESIST! 




© Make Projects 



www.makeprojects.com 



Page 4 of 7 



Hacking the Wii MotionPlus to Talk to the Arduino 





ams... 



Make Proje 




• Now that you're able to read data 
from the wm+, there are many 
uses for your hack! They include: 

• Cheap DIY inertial measurement 
(IMU) for a quadcopter 

• Sharks with gyroscopes! 

• DIY motion control for a robot 

• Controlling up to three 
servomotors (one for each axis) 

• If you are feeling ambitious, I've 
uploaded some code to control two 
servos with the wm+ here: 
http://bit.ly/h13uAj Go ahead and 
give it a try... 



© Make Projects 



www.makeprojects.com 



Page 5 of 7 



Hacking the Wii MotionPlus to Talk to the Arduino 






OttGj 



^*5 ^Aorrovi 9uv)S 








Make Projects 



There are a few reasons why one might want to remove the wm+ electronics from its 
housing. Here is the data you'll need to solder to the board and access your gyro data. 



• The newer boards use a ribbon cable to attach to the gyro board. I recommend you 
solder headers or wires directly to the pads vs. using the ribbon cable. 

• 6 = GND 

• 5 = SDA 

• 2 = SCL 

• 1 = Vcc (CAUTION: 3v MAX!) 

• The obscured label at the top of the wm+ diagram reads: IDG-600. That's the 
InvenSense gyro controller chip. 



& 







© Make Projects 



www.makeprojects.com 



Page 6 of 7 



Hacking the Wii MotionPlus to Talk to the Arduino 





• wm+ hardware information: 
http://bit.ly/rnOi1 

• Arduino i2c basics: 
http://bit.ly/8Y5sQ1 

• Arduino servo lib: 
http://bit.ly/gzHr6l 

• Miles Moody's wm+ orginial post 
http://bit.ly/gr2Zx 

• Advanced wm+ & servo code 
thread: http://bit.ly/fLgONk 



For Arduino news, features, tutorials, a buyer's guide, and more, visit the Make: Arduino page . 



This document was last generated on 201 2-11 -01 11 :37:22 PM. 



© Make Projects 



www.makeprojects.com 



Page 7 of 7